{
  "contentVersion": "1.0.0.0",
  "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "parameters": {
    "storageAccountName": {
      "type": "string",
      "metadata": {
        "description": "The name of the storage account which will be assocaited to the the workspace."
      }
    },
    "mlWorkspaceName": {
      "type": "string",
      "defaultValue": "",
      "metadata": {
        "description": "The name of the Azure ML workspace getting created."
      }
    }
  },
  "variables": {
    "location": "[resourceGroup().location]",
    "storageAccountName": "[parameters('storageAccountName')]",
    "mlWorkspaceName": "[parameters('mlWorkspaceName')]",
    "mlVersion": "2016-04-01",
    "mlResourceId": "[resourceId('Microsoft.MachineLearning/workspaces', variables('mlWorkspaceName'))]",
    "stgResourceId": "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]"
  },
  "resources": [
    {
      "apiVersion": "[variables('mlVersion')]",
      "type": "Microsoft.MachineLearning/workspaces",
      "name": "[variables('mlWorkspaceName')]",
      "location": "[variables('location')]",
      "dependsOn": [
      ],
      "properties": {
        "UserStorageAccountId": "[variables('stgResourceId')]"
      }
    }
  ],
  "outputs": {
    "mlWorkspaceObject": {
      "type": "object",
      "value": "[reference(variables('mlResourceId'), variables('mlVersion'))]"
    },
    "mlWorkspaceToken": {
      "type": "object",
      "value": "[listWorkspaceKeys(variables('mlResourceId'), variables('mlVersion'))]"
    }
  }
}
